/* Copyright  2009
   @Author
   Richard Changde Yin            e-mail yinchangde@hotmail.com

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; version 2 of the License.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
   
/*
* @filename: signed.h
*/
#ifndef COLLAPSAR_FUNCTION_SIGNED_H
#define COLLAPSAR_FUNCTION_SIGNED_H

#include <function/math/int.h>
#include <function/func.h>

class Item_func_signed :public Item_int_func
{
public:
  Item_func_signed(Item *a) :Item_int_func(a) {}
  const char *func_name() const { return "cast_as_signed"; }
  int64_t val_int();
  int64_t val_int_from_str(int *error);
  void fix_length_and_dec()
  { max_length=args[0]->max_length; unsigned_flag=0; }
  virtual void print(String *str, enum_query_type query_type);
  uint32_t decimal_precision() const { return args[0]->decimal_precision(); }
};

#endif /* COLLAPSAR_FUNCTION_SIGNED_H */
